package demo;

import org.apache.log4j.Logger;
import org.junit.Test;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.InputMismatchException;
import java.util.Scanner;


public class AppTreeTest {

   static Logger logger=Logger.getLogger(AppTreeTest.class);

    @Test
    public void test1(){


    }

     public  static  void fileTest() throws IOException {
         FileInputStream is=null;
         File file=new File("");
         try {
             is=new FileInputStream(file);
         } catch (Exception e) {
             e.printStackTrace();
         }finally {
            is.close();
         }
     }


     public  static  void TreeException() throws Exception {
        Scanner in=new Scanner(System.in);
         System.out.println("请输入果实的数量:");
         int weight=in.nextInt();
         if(weight<10){
             throw new Exception("必须大于10");
         }
         System.out.println("请输入商家的数量:");
         int num=in.nextInt();
         System.out.println("每家果商分到的果实数量是:"+weight/num);
     }



     public  static  void ShowTicketPrice() throws PayException {
        Scanner in=new Scanner(System.in);
         logger.debug("请输入要购买的票数");
        int num1=in.nextInt();
        if(num1<1){
            throw new PayException("您输入的购票数至少为1张！");
        }
         logger.debug("请输入你支付的金额");
         int money=in.nextInt();
         if((num1*50)>money){
            throw new PayException("您支付的钱不够");
        }
     }




    public static void main(String[] args) throws IOException {
      /*  try {
            AppTreeTest.ShowTicketPrice();
        } catch (PayException e) {
            e.printStackTrace();
        }*/
        Scanner in = new Scanner(System.in);
       logger.debug("输入1-3");
        try{
            int num = in.nextInt();
            if (num >= 1 && num <= 3) {
                System.out.println("输入正确");
            }else {
                System.out.println("超过了范围");
            }
        }catch (Exception e){
            System.err.println("不是数字");
            e.printStackTrace();
        }finally {
            System.out.println("欢迎使用本程序");
        }
    }
    }
